package weeek11.topic08;

/**
 * @author lfy
 */
public class Test {
    public static void main(String[] args) throws InterruptedException {
        String host = "127.0.0.1";
        int port = 6379;
        String channel = "test_channel";
        Publish publish = new Publish(host,port);
        Subscribe subscribe = new Subscribe(host,port);
        subscribe.subscribe(channel);
        //等待一会保证订阅者启动
        Thread.sleep(500);
        publish.publish(channel,"message1");
        publish.publish(channel,"message2");
        publish.publish(channel,"message3");

        Thread.sleep(1000);
        System.exit(0);
    }
}
